<%@ page language="java" contentType="text/html;" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<title>订单查询-支付票款</title>
<jsp:include page="../inc.jsp"></jsp:include>

<style type="text/css">
 .yellow_btn{
	border: none;
	border-radius: 5px;
	background-color: #FF6600;
	color: #FFFFFF;
	padding: 5px 20px;
	height: 25px;
	margin:3px 10px;
	font-weight: bold;
	text-decoration:none;
}	
.list_wrap{
    list-style: none;
    margin-top: 10px;
}
.list_wrap li{
    padding: 5px;
}
.table_b{
    border: 1px dotted #ddd;
    margin-bottom:5px;
    margin-top:-10px;
    margin-left:20px;
    border-left:1px dotted #95b8e7;
    border-top:1px dotted #95b8e7;
}
.table_b thead{
    color:#4474BB;
    font-weight: bold;
}
.table_b td{
	border:1px dotted #ddd;
	padding:5px;
	text-align: center;
}
.font_money {
	color:#FF6600;
	font-size: 20px;
}
</style>
<script type="text/javascript">
$(function(){
	$.ajax({
		type:'get',
		url:'${ctx}/order/orderDetail/${orderNumber}',
		dataType:'json',
		success:function(data){
			if(data.success){
				$("#data1").html(data.obj.orderNumber);
				$("#data3").html(CommonConverter.formatMoney(data.obj.purchQuantity*data.obj.unitPrice));
				$("#payPrice").val(CommonConverter.formatMoney(data.obj.purchQuantity*data.obj.unitPrice));
			}
			else{
				layer.alert(data.msg);
			}
		},
		error:function(msg){
			layer.alert("请检查您的网络连接，然后重试！");
		}
	}); 
});
function submitPay(){
	progressLoad();
	var isValid = $('#data').form('validate');
	if (!isValid) {
		progressClose();
		return;
	}
	var obj = {
	            "payMoney": "",
	            "payName": "",
	            "payAccount": ""
	        }
	obj.payMoney = $("#payPrice").val();
	obj.payName = $("#payName").val();
	obj.payAccount = $("#payAccount").val();
	$.ajax({
		type:'post',
		url:'${ctx}/order/savePay/${orderNumber}',
		contentType:'application/json;charset=utf-8',
		data:JSON.stringify(obj),
		success:function(data){
			if(data.success){
				layer.alert('支付提交成功！',{skin:'layui-layer-lan',title: ['系统提示', 'background-color:#00B2EE; color:#fff;'],closeBtn: 0}, function(index){
					closeWin();
					layer.close(index);
				});
			}
			else{
				layer.alert(data.msg);
			}
		},
		error:function(msg){
			layer.alert("请检查您的网络连接，然后重试！");
		}
	}); 
}
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
function closeWin(){
	 parent.layer.close(index);
}
</script>
</head>
<body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center'" >
			<div class="easyui-panel" title="支付提交" style="height: auto;">
			<br>
				<table cellpadding="0" cellspacing="0" style="width: 90%" class="table_b">
					<tr >
						<td width="10%">收款账户</td>
						<td style="text-align: left;">账户名称：天津伊翔运达网络科技有限公司</td>
					</tr>
					<tr>
						<td></td>
						<td style="text-align: left;">银行账户：77230154740008953</td>
					</tr>
					<tr>
						<td></td>
						<td style="text-align: left;">开户银行：上海浦东发展银行股份有限公司天津科技支行</td>
					</tr>
				</table>
				<br>
				<table cellpadding="0" cellspacing="0" style="width: 90%"  class="table_b">
					<thead>
					<tr >
						<td width="10%">订单号</td>
						<td width="10%">支付方式</td>
						<td width="10%">金额</td>
					</tr>
					</thead>
					<tr>
						<td><span id="data1"></span></td>
						<td><span id="data2">线下付款</span></td>
						<td><span id="data3"></span></td>
					</tr> 
				</table>
				<br>
				<table cellpadding="0" cellspacing="0" style="width: 90%"  class="table_b">
					<tr >
						<td width="10%">支付凭证</td>
						<td style="text-align: left;">
						<form id="data" method="post">
							<table border="0">
								<tr>
									<td style="text-align: right;">金额：</td>
									<td><input type="text" readonly="readonly" id="payPrice" style="width: 300px;height: 23px" ></td>
								</tr>
								<tr>
									<td style="text-align: right;">账号 ：</td>
									<td><input class="easyui-validatebox" value="" id="payAccount" style="width: 300px;height: 23px" data-options="required:true"  validtype="charnum"></td>
								</tr>
								<tr>
									<td style="text-align: right;">账户名称 ：</td>
									<td><input class="easyui-validatebox" value="" id="payName" style="width: 300px;height: 23px" data-options="required:true"></td>
								</tr>
							</table>
							</form>
						</td>
					</tr>
					 
				</table>
			</div>
			<div style="height: 30px;text-align: center;" >
				<input type="button" value="提交支付凭证" class="yellow_btn" onclick="submitPay();">
				<input type="button" value="取消" class="yellow_btn" onclick="closeWin();">
			</div>
 		</div>
	</div>

 
</body>
</html>